<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useUserStore } from '@/stores/user'
import { useAppStore } from '@/stores/app'

const userStore = useUserStore()
const appStore = useAppStore()

onMounted(() => {
  // 初始化应用
  appStore.initApp()
  
  // 检查用户登录状态
  const token = localStorage.getItem('token')
  if (token) {
    userStore.getUserInfo()
  }
})
</script>

<style lang="scss">
#app {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

// 全局滚动条样式
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
  
  &:hover {
    background: #a8a8a8;
  }
}

// Element Plus 组件样式调整
.el-message {
  min-width: 300px;
}

.el-notification {
  .el-notification__title {
    font-weight: 600;
  }
}

// 响应式布局
@media (max-width: 768px) {
  .el-dialog {
    width: 90% !important;
    margin: 5vh auto !important;
  }
  
  .el-table {
    font-size: 12px;
  }
}
</style>